[php].=是什么意思啊

来源:百度知道 编辑:UC知道 时间:2024/06/05 15:31:42
function ShowListTable($array,$editurl="",$deleteurl="",$id="clid"){
//表头
$str='<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#99CCFF">';
$str.="<caption>列表管理</caption>";
$str.="<tr>";
if($editurl) $str.='<td height="30" bgcolor="#FFFFFF">修改</td>';
if($deleteurl) $str.='<td height="30" bgcolor="#FFFFFF">删除</td>';
foreach($array[0] as $key=>$value){
$string.='<td height="30" bgcolor="#FFFFFF">'.$key.'</td>';
}
$str.=$string."</tr>";
unset($string);

.是字符串连接符

$a = "hello";
$b = " world";
$a .= $b;//$a就是 "hello world"

'.'是用于字符串链接,和vc里的‘+’号,还有javascript里的‘+’的功能相同,'='是赋值运算符。
而.=就是组合运算符,$a.=$b它等同于$a = $a.$b;它和c语言是一样的,比如$i+=1相当于$i=$i+1
请参考php手册,运算符

$a .= $b

就是

$a = $a . $b

php中 . 就是字符串连接(字符串相加)